<?php
header('Content-Type:text/html;charset=utf8');
require('./FileUpload2.class.php');
require('image.class.php');
echo '<pre>';
    print_r($_FILES);
echo '</pre>';
//$up = new FileUpload('./uploads', array('txt', 'jpg', 'gif', 'png'), 2000000, false);
$up = new FileUpload(array('filepath'=>'./uploads/', 'maxsize'=>1000000, 'israndname'=>true));
$res = $up->uploadFile('spic');

if ($res)
{
    $filename = $up->getNewFileName();
    $img = new Image('./uploads');
    $th_filename = $img->thumb($filename, 300, 300, 'th_');  //缩放后再加水印
    $wa_filename = $img->addWatermark($th_filename, './ai.gif', 5, 'wa_');   //传水印图片时加了文件夹啊
    $img->addWatermark($filename, './clock.gif', 0, 'wa1_');   //直接对原图加水印
    $img->cut($filename, 30, 30, 200, 200, 'cu_');
}
else
{
    print_r($up->getErrorMsg());
}
?>
